<?php echo $this->render('header.phtml'); ?>
<label class="title">Quản lý hàng hóa - Những tin rao mua hàng đã đăng.</label>
<div class="horiz_sep">&nbsp;</div>
<!-- a href="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/add">Add a new commodity</a -->
<?php 
	$commodities = $this->commodities;
	$utilities = $this->utilities; 
?>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
	<td>
		<table cellpadding="0" cellspacing="0" width="100%">
			<?php
				$i=0;
				$count = count($commodities);
				foreach ($commodities as $commodity) {
					$i++;
			?>
			<?php
				if ($i%2 != 0){			
					echo "<tr><td style='padding-top: 5px;' width='50%'>";							
				}
			?>	
				<table cellpadding="5" cellspacing="0" width="100%" style="border:1px solid #cccccc;">
					<tr style="background-color: #81d2f6;">
						<td align="right">	
							<a href="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/view/id/<?php echo $commodity->com_id;?>">View</a>
							&nbsp;&nbsp;						
							<a href="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/edit-buy/id/<?php echo $commodity->com_id;?>">Edit</a>							
						</td>
					</tr>
					<tr>						
				  		<td valign="top">
				  			<table cellpadding="2" cellspacing="0" width="100%" border="0">
				  				<tr>
							    	<th>Name:</th>
							    	<td><?php echo $commodity->com_name; ?></td>
							  	</tr>
								<!-- tr>
							    	<th>Description:</th>
							    	<td><?php //echo $commodity->com_description; ?></td>
							  	</tr-->
							  	<tr>
							    	<th>Price:</th>
							    	<td><?php echo $commodity->com_price; ?></td>
							  	</tr>
							  	<tr>
							    	<th>Vip:</th>
							    	<td>
							    		<?php
							    			if ($commodity->com_vip) echo "<b>YES</b>";  
							    			else echo "<b>NO</b>";
							    		?>
							    	</td>
							  	</tr>							  	
				  			</table>
				  		</td>
				  	</tr>
				</table>
			<?php
					if ($i%2 == 0){					
						echo "</td></tr>";
					}else{					
						echo "</td><td style='padding-top: 5px; padding-left:5px;' width='50%'>";
					}
			?>		  			
	  		<? } // End for.?>		  		
		</table>
	</td>
</tr>  	
<tr>
	<td>
		<?php echo $this->page; ?>
	</td>
</tr>
</table>
<?php echo $this->render('footer.phtml');?> 